<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no" />
	<title>首页</title>
	<link rel="stylesheet" type="text/css" href="../c/aui.css" />
	<style>
		body,html{
			height: 100%;
		}
		.aui-card-list
		,.aui-card-list li
		,.aui-card-list ul
		,.aui-list .aui-list-item
		{
			background: none;
			border: 0;
			color: #fff;
		}
		.sx-jinbi{
			background: #000;
		}
		.sx-jinbi .l p {
			font-size: 0.75rem;
			color: #fff;
			letter-spacing: 1.5px;
			padding-bottom: 0.35rem;
		}

		.sx-jinbi .l p span {
			padding-left: 0.5rem;
		}

		.sx-jinbi .l b {
			font-size: 1.8rem;
			color: #fff;
			letter-spacing: 1.5px;
			font-weight: 400
		}
		.sx-jinbi .r {
			background: #161823;
			color: #fff;
			border-radius: 1rem;
			padding: 0.25rem 0.75rem;
			font-size: 0.75rem;
		}
		.sx-money{
			padding: 0.375rem
		}
		.sx-money .aui-col-xs-4{
			padding: 0.375rem;
			text-align: center;
		}
		.sx-money .p b{
			font-size: 1rem;
			letter-spacing: 1.5px;
			display:inline-block;
			padding-bottom: 0.15rem;
		}
		.sx-money .p{
			border: 1px solid #2d2d2d;
			padding: 0.5rem 0;
			border-radius: 0.35rem;
		}
		.sx-money .p p{
			font-size: 0.6rem;
			opacity: 0.7
		}
		.sx-money .a{
			border: 1px solid #eba825;
			background: url('../i/jinbi/tixian_ico.png') no-repeat;
			background-size: 1rem;
		}
		.sx-money .a b{
			color: #eba825
		}
		.sx-money .a p{
			color: #eba825
		}
		.sx-money .h2{
			padding: 0.25rem 0.5rem;
		}
		.sx-money{
			background: #000;
			margin-top: 0.25rem;
			font-size: 0.75rem;
		}
		/*body,.aui-content{
			height: 100%;
		}*/
		.aui-content{
			position: relative;
		}
		.sx-btn{
			position: fixed;;
			bottom: 0;
			width: 100%;
			left: 0;
			background: #000;
			/*padding: 0.75rem;*/
			box-shadow: 0px 0px 15px 0px #484848;
		}
		.sx-btn div{
			background: #FE2C55;
			font-size: 0.75rem;
			text-align: center;
			padding: 0.5rem 0;
			width: 80%;
			margin: 1rem auto;
			border-radius: 1rem;
		}
		.sx-content{
			/*background: #000;*/
			margin-top: 0.25rem;
			padding: 0.75rem;
			margin-bottom: 5rem;
		}
		.sx-content .h2{
			font-size: 0.75rem;
			padding-bottom: 0.5rem;
		}
		.sx-content .p{
			font-size: 0.65rem;
			color: #fff;
			opacity: 0.7;
			letter-spacing: 1px;
		}
		.sx-content .p p{
			padding: 0.1rem 0;
		}
		.sx-pay{
			background: #000;
			margin-top: 0.25rem;
			padding: 0.75rem;
		}
		.sx-pay .h2{
			font-size: 0.75rem;
		}
		.sx-pay .t{
			display: flex;
			padding-top: 0.5rem;
			margin-left: -0.375rem;
			margin-right: -0.375rem;
		}
		.sx-pay .t div{
			border: 1px solid #2d2d2d;
			padding: 0.35rem 1rem;
			border-radius: 0.35rem;
			font-size: 0.85rem;
			width: 50%;
			text-align: center;
			margin: 0.357rem;
		}
		.sx-pay .t div.a{
			border: 1px solid #eba825;
			background: url('../i/jinbi/tixian_ico.png') no-repeat;
			background-size: 1rem;
		}
		.sx-pay .t div.a{
			color: #eba825
		}
		.sx-pay .t div.a{
			color: #eba825
		}
		.info .aui-card-list-footer{
			padding: 0;
			padding-top: 1rem;
		}
		.info .aui-card-list-footer div.img div{
			line-height: 1.2rem;
			font-size: 0.65rem;
			font-weight: 300;
			letter-spacing: 1px;
			padding-left: 0.35rem;
		}
		.info .aui-card-list-footer div.img{
			display: flex;
			color: #fff;
			width: 100%;
		}
		.info img{
			width: 1.2rem;
			height: 1.2rem;
			border-radius: 50%;
			background: #fff;
		}
		.info .right{
			font-size: 0.7rem;
			color: #fff;
			width: 30%;
			text-align: right
		}
		.info .right i{
			font-size: 0.65rem;
			padding-left: 0.25rem;
			color: #fff;
		}
		.zhuanxiang{
			position: absolute;
			right: 0;
			top:0;
			background: #f00;
			color: #fff;
			padding: 0rem 0.35rem;
			border-radius: 1rem;
			font-size: 0.55rem;
			margin-right: 0.45rem;
		}
	</style>
</head>

<body>
	<script id="sx-list" type="text/x-dot-template">
		<div class="sx-jinbi aui-card-list-footer">
			<div class="l">
				<p>我的金币<span>(约{{= it.user.money}}元)</span></p>
				<b>{{= _money(it.user.jinbi)}}</b>
			</div>
			<div class="r" tapmode onclick="_url({url:'member_tixian_list',title:'提现记录'})">提现记录</div>
		</div>
		<div class="sx-pay">
			<div class="h2">提现方式</div>
			<div class="t">
				<div class="a" tapmode onclick="sxPay(this,1)" data-pay="1">支付宝</div>
				<div tapmode onclick="sxPay(this,2)" data-pay="2">微信</div>
			</div>
			<div class="info">
				<div id="pay_1" class="aui-card-list-footer" data-id='{{? it.band['alipay']}}{{= it.band['alipay'].id}}{{?}}'>
					<div class="img">
						<img src="../i/share/alipay.png" />
						{{? it.band['alipay']}}
						<div class="aui-ellipsis">{{= it.band['alipay'].data.xingming}}<span>{{= it.band['alipay'].data.zhanghu}}</span></div>
						{{??}}
						<div class="aui-ellipsis">您尚未设置支付宝账户 <span></span></div>
						{{?}}
					</div>
					<div class="right" tapmode onclick="_url({url:'member_tixian_band',title:'绑定支付宝账户',pay:1});">{{? it.band['alipay']}}已绑定{{??}}立即绑定{{?}}<i class="aui-iconfont aui-icon-right"></i></div>
				</div>
				<div id="pay_2" class="aui-card-list-footer aui-hide" data-id='{{? it.band['weixin']}}{{= it.band['weixin'].id}}{{?}}'>
					<div class="img">
						<img src="../i/share/session.png" />
						{{? it.band['weixin']}}
						<div class="aui-ellipsis" data-img="{{= it.band['weixin'].data.img}}" tapmode onclick="image(this)"> 查看收款码 </div>
						{{??}}
						<div class="aui-ellipsis" tapmode onclick="image(this)">您尚未绑定微信账户 <span></span></div>
						{{?}}
					</div>
					<div class="right" tapmode onclick="_url({url:'member_tixian_band',title:'绑定微信收款码',pay:2});">{{? it.band['weixin']}}已绑定{{??}}立即绑定{{?}}<i class="aui-iconfont aui-icon-right"></i></div>
				</div>
			</div>
		</div>
		<div class="sx-money">
			<div class="h2">提现金额</div>
				<div class="aui-row">
				{{ for(var i=0,it=it.list; i < it.length; i++) { }}
				<div class="aui-col-xs-4">
					<div class="p {{= i == 0?'a':''}}" tapmode onclick="sxMoney(this)" data-money='{{= it[i].money }}' data-id='{{= it[i].id }}'>
						<b>{{= it[i].money }}元</b>
						<p>{{= it[i].jinbi }}金币</p>
					</div>
					{{? it[i].content}}
					<div class="zhuanxiang">{{= it[i].content}}</div>
					{{?}}
				</div>
				{{ } }}
			</div>
		</div>
		<div class="sx-content">
			<div class="h2">提现说明</div>
			<div class="p"></div>
		</div>
		<div class="sx-btn">
			<div tapmode onclick="add()">立即提现</div>
		</div>
	</script>
	<div class="aui-content"  id="sx-view"><div id="loadingdi_huifu" style=" margin-top:50% "><img src="../i/footer_progress.png" /></div></div>
</body>
<script type="text/javascript" src="../j/api.js"></script>
<script type="text/javascript">
	var user_jinbi = user_money = user_bili = 0
	apiready = function() {

		money_list();
		_shangla(function(){
			money_list();
		},1)
	}
	function add(){
		var money = $('.sx-money .a').data('money');
		var money_id = $('.sx-money .a').data('id');
		var pay = $('.sx-pay .t .a').data('pay');
		var band_id = $('#pay_'+pay).data('id');
		if(!money) return _msg('请选择提现金额');
		if(!pay) return _msg('请选择提现方式');
		_loading();
		_ajax('member/tixian_add',function(ret,err){
			_loadingCloes();
			if(ret){
				if(ret.ret){
					_msg(ret.ret);
					money_list();
					_userInfo();
				}else{
					_alert(ret.err)
				}
			}else{
				_alert(JSON.stringify(err));
			}
		},{money:money,pay:pay,band_id:band_id,money_id:money_id})
	}
	function money_list(){
		_ajax('member/tixian_money_list',function(ret,err){
			if(ret){
				var evalData = doT.template($api.html($api.byId('sx-list')));
				$api.html($api.byId('sx-view'), evalData(ret));
				api.parseTapmode();
				api.refreshHeaderLoadDone();
				$api.fixTabBar($api.dom('.sx-btn'));
				$('.sx-content .p').html(_getPrefs('_config').config.tixian_text);
			}else{
				_alert(JSON.stringify(err));
			}
		})
	}
	// 选择提现方式
	function sxPay(_this,a){
		$('.sx-pay .t div.a').removeClass('a');
		_this = $(_this);
		_this.addClass('a');
		$('.info div.aui-card-list-footer').addClass('aui-hide');
		$('.info #pay_'+a).removeClass('aui-hide');
	}
	// 选择金额
	function sxMoney(_this){
		$('.sx-money .a').removeClass('a');
		_this = $(_this);
		_this.addClass('a');
	}
	function tixian_band(a){
		console.log(a);
		a = eval('('+a+')');
		console.log(JSON.stringify(a));
		if(a.pay == 1){
			$('.info #pay_'+a.pay+' .img .aui-ellipsis').html(a.xingming+'<span>'+a.zhanghu+'</span>');
		}else{
			$('.info #pay_'+a.pay+' .img .aui-ellipsis').data('img',a.img)
			$('.info #pay_'+a.pay+' .img .aui-ellipsis').html('查看收款码');
		}
		$('.info #pay_'+a.pay).data('id',a.id);
		$('.info #pay_'+a.pay+' .right').html('已绑定<i class="aui-iconfont aui-icon-right"></i>');
	}
	function image(_this){
		var img = $(_this).data('img');
		if(!img){
			return;
		}
	//	console.log(img)
		_image({img:_img(img)})
	}

</script>

</html>
